package com.gite.nouette.admin.implementation.application.init;

import com.gite.nouette.admin.contract.application.init.IInitializer;
import com.gite.nouette.admin.contract.application.init.IInitializerAdmin;
import com.gite.nouette.admin.contract.application.init.IInitializerFactory;
import com.gite.nouette.admin.contract.controller.IController;

public class InitializerImpl implements IInitializer {
	private IController<?, ?> mainController;

	private IInitializerFactory initializerFactory;
	private IInitializerAdmin initializerAdmin;

	public InitializerImpl() {
		init();
	}

	@Override
	public IController<?, ?> getMainController() {
		return this.mainController;
	}

	public void setMainController(IController<?, ?> mainController) {
		this.mainController = mainController;
	}

	@Override
	public IInitializerFactory getInitializerFactory() {
		return this.initializerFactory;
	}

	public void setInitializerFactory(IInitializerFactory initializerFactory) {
		this.initializerFactory = initializerFactory;
	}

	@Override
	public IInitializerAdmin getInitializerAdmin() {
		return this.initializerAdmin;
	}

	public void setInitializerAdmin(IInitializerAdmin initializerAdmin) {
		this.initializerAdmin = initializerAdmin;
	}

	public void init() {
		setInitializerFactory(new InitializerFactoryImpl());
		setInitializerAdmin(new InitializerAdminImpl());
		getInitializerAdmin().setFactoryController(
				getInitializerFactory().getFactoryController());
		getInitializerAdmin().init();
		setMainController((IController<?, ?>) getInitializerAdmin().getAdmin());
	}

}
